
<%--
  Created by IntelliJ IDEA.
  User: Ray
  Date: 2019/9/11
  Time: 21:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>首页</title>
    <link rel="stylesheet" href="${path}/plugins/bootstrap/css/bootstrap.css" type="text/css">
</head>
<body>
<%@include file="../common/header.jsp"%>
<div class="container-fluid" style="margin-top:20px;margin-bottom:20px">
    <div class="row">
        <div class="col-md-3">
            <select class="form-control" id="phoneType" onchange="changeType(this)">
                <option value="-1">===请您选择手机类型===</option>
                <c:forEach items="${requestScope.phoneTypeList}" var="pt">
                    <c:if test="${pt.id == param.typeId}">
                        <option selected value="${pt.id}">${pt.typeName}</option>
                    </c:if>
                    <c:if test="${pt.id != param.typeId}">
                        <option value="${pt.id}">${pt.typeName}</option>
                    </c:if>
                </c:forEach>
            </select>
        </div>
        <div class="col-md-3">
            <div class="input-group">
                <input type="text" class="form-control" id="searchName" value="${param.name}">
                <span class="input-group-btn">

                    <button class="btn btn-default" type="button" onclick="selectAll()">查询</button>
                </span>
            </div>
        </div>
        <c:if test="${!empty sessionScope.user && sessionScope.user.power==0}">
            <div class="col-md-5">
                <button type="button" class="btn btn-info" onclick="insertAny()">添加</button>&nbsp;&nbsp;
                <button type="button" class="btn btn-danger" onclick="delAny()">删除</button>
            </div>
        </c:if>
    </div>
</div>
<div class="container-fluid">
    <div class="row" id="phone">
            <c:forEach items="${requestScope.pageInfo.list}" var="p">
                <c:if test="${p.status==0}">
                    <a href="${path}/phone/details?id=${p.id}" class="text-danger">
                        <div class="col-md-3">
                            <div class="thumbnail">
                                <c:if test="${!empty sessionScope.user && sessionScope.user.power==0}">
                                    <input type="checkbox" value="${p.id}" name="cks">
                                </c:if>
                                <img src=" ${p.url} " alt="通用的占位符缩略图">
                                <div class="caption" style="overflow:hidden">
                                    <h3 align="center" class="text-success">${p.name}</h3>
                                    <p style="text-align:center">${p.intro}</p>
                                    <p style="float:right">
                                        <a href="" onclick="like()" class="text-warning">
                                            <span class="glyphicon glyphicon-heart"></span>
                                        </a>
                                    </p>
                                    <c:if test="${!empty sessionScope.user && sessionScope.user.power==0}">
                                        <p style="float:left">
                                            <a href="${path}/phone/del/one?id=${p.id}" class="text-danger">
                                                <span class="glyphicon glyphicon-trash"></span>
                                            </a>
                                        </p>
                                        <p style="float:right">
                                            <a href="${path}/phone/update?id=${p.id}" class="text-warning">
                                                <span class="glyphicon glyphicon-edit"></span>
                                            </a>
                                        </p>
                                    </c:if>

                                </div>
                            </div>
                        </div>
                    </a>
                </c:if>
            </c:forEach>
    </div>
</div>
<%--导入分页标签--%>
<%@ include file="../common/page.jsp" %>
<%--目的:为了让外部的js文件使用灵活的项目的上下文路径--%>
<input type="hidden" value="${path}" id="path">

<script src="${path}/plugins/bootstrap/jquery/jquery.min.js"></script>
<script src="${path}/plugins/bootstrap/js/bootstrap.js"></script>
<script src="${path}/js/phone.js"></script>
</body>
</html>
